import { request } from '../request';

// Service相关类型定义
export interface AvailableServicesResponse {
  [serviceName: string]: string[];
}

export interface ServiceMethodInfo {
  name: string;
  parameterCount: number;
  parameterTypes: string[];
  returnType: string;
}

export interface ServiceMethodsResponse {
  serviceName: string;
  className: string;
  methods: ServiceMethodInfo[];
}

export interface ApiResponse<T> {
  code: number;
  data: T;
  message: string;
}

// Service相关的API请求
export const fetchAvailableServices = () => {
  return request<Record<string, string[]>>({
    url: '/api/compute/service/available',
    method: 'get'
  });
};

export const fetchServiceMethods = (serviceCode: string) => {
  return request<any>({
    url: '/api/compute/service/methods',
    method: 'get',
    params: { serviceName: serviceCode }
  });
};
